package com.app.micaihu.view.army.activity

import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation
import com.app.base.BaseMvpActivity
import com.app.micaihu.R
import com.app.micaihu.view.army.contract.ArmyMemberContract
import com.app.micaihu.view.army.presenter.ArmyMemberPresenter
import kotlinx.android.synthetic.main.army_medal_detail_activity.*


/**
 * 军团勋章详情
 */
class ArmyMedalDetailActivity : BaseMvpActivity<ArmyMemberContract.View, ArmyMemberPresenter>(), ArmyMemberContract.View {

    override fun getLayoutId() = R.layout.army_medal_detail_activity

    override fun getPresenter() = ArmyMemberPresenter("")

    private val rotateAnimation: RotateAnimation by lazy {
        val rotate = RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)
        rotate.interpolator = LinearInterpolator()
        rotate.duration = 5000 //设置动画持续周期
        rotate.repeatCount = -1 //设置重复次数
        rotate.fillAfter = true //动画执行完后是否停留在执行完的状态
        rotate.startOffset = 10 //执行前的等待时间
        rotate
    }

    override fun setData() {
        ivArmyMedalBg.animation = rotateAnimation
    }

    override fun addListeners() {

    }

    override fun onDestroy() {
        super.onDestroy()
        ivArmyMedalBg.animation = null
    }
}